home *** CD-ROM | disk | FTP | other *** search
- package horst;
-
- import java.awt.Rectangle;
- import java.net.URL;
-
- public class IFrameView extends ComponentView {
- int m_width;
- int m_height;
-
- public IFrameView(View parent, Element e, HTMLPane container) {
- super(parent, e, container);
- }
-
- protected int getMinimumSpan(int axis) {
- return this.getPreferredSpan(axis);
- }
-
- protected int getPreferredSpan(int axis) {
- switch (axis) {
- case 0:
- return this.m_height;
- case 1:
- return this.m_width;
- default:
- return 100;
- }
- }
-
- protected void init() {
- int frameBorder = Utilities.setIntegerProperty(1, "frameborder", super.m_elem.getAttributes());
- boolean bScrolling = Utilities.setBooleanProperty(true, "scrolling", super.m_elem.getAttributes());
- HTMLWindow htmlWnd = new HTMLWindow(frameBorder != 1);
- HTMLPane renderer = htmlWnd.getHTMLPane();
- renderer.m_preferences.m_bShowToolTip = false;
- renderer.m_props.m_bIsIFrame = true;
- int marginWidth = Utilities.setIntegerProperty(super.m_container.m_props.m_marginWidth, "marginwidth", super.m_elem.getAttributes());
- int marginHeight = Utilities.setIntegerProperty(super.m_container.m_props.m_marginWidth, "marginheight", super.m_elem.getAttributes());
- renderer.setMargins(marginWidth, marginHeight);
- super.m_comp = htmlWnd;
- super.m_container.add(super.m_comp);
- URL u = Utilities.setURLProperty(super.m_elem.getDocument().getBaseURL(), "src", super.m_elem.getAttributes());
- if (u != null) {
- renderer.openPage(u);
- }
-
- super.m_alignment = Utilities.setAlignmentProperty(false, 0, "align", super.m_elem.getAttributes());
- this.m_width = Utilities.setIntegerProperty(100, "width", super.m_elem.getAttributes());
- this.m_height = Utilities.setIntegerProperty(100, "height", super.m_elem.getAttributes());
- }
-
- protected boolean isFloater() {
- String align = (String)super.m_elem.getAttribute("align");
- if (align == null) {
- return false;
- } else {
- return align.equalsIgnoreCase("left") || align.equalsIgnoreCase("right");
- }
- }
-
- protected Rectangle layout(int x, int y, int width, LayoutInfo info) {
- super.m_bounds.setBounds(x, y, this.getPreferredSpan(1), this.getPreferredSpan(0));
- super.m_comp.setBounds(super.m_bounds);
- return super.m_bounds;
- }
- }
-